package com.androidtv.pos.ui;

import android.os.Bundle;
import android.os.Message;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.FrameLayout;

import com.androidhelper.module.common.base.BaseActivity;
import com.androidtv.pos.R;
import com.androidtv.pos.UIHelper;

import androidx.annotation.Nullable;
import butterknife.BindView;

public class SplashActivity extends BaseActivity {

    @BindView(R.id.rootView)
    FrameLayout rootView;
    private AlphaAnimation mAa;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_splash;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        toMain();
    }

    private void toMain() {
        mAa = new AlphaAnimation(0.2f, 1.0f);
        mAa.setDuration(2000);
        rootView.startAnimation(mAa);
        mAa.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                UIHelper.jumptoPosLoginActivity(SplashActivity.this);
                finish();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });


    }

    @Override
    protected void loadData(@Nullable Bundle savedInstanceState) {

    }

    @Override
    protected void setListener() {

    }

    @Override
    protected void initStatusBar() {

    }

    @Override
    public void handleMessage(Message msg) {

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(mAa!=null){
            mAa.cancel();
            mAa=null;
        }




    }
}
